package cn.edu.gzgs.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 用户/教职工实体
 *
 * @author Zyf
 * @since 2024-05-29
 */
@Data
@TableName("user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("user_no")
    private String userNo; // 工号

    private String name; // 姓名

    private String password; // BCrypt加密

    @TableField("dept_id")
    private Long deptId; // 所属部门ID

    @TableField("entry_date")
    private LocalDate entryDate; // 来校日期

    private String remark; // 备注

    @TableLogic(value = "1", delval = "-1") // 逻辑删除注解
    private Integer status = 1; // 用户状态：1-正常，0-禁用, -1-已删除

    private LocalDateTime createdTime;

    private LocalDateTime updatedTime;

    // ----------------- 以下为非数据库字段 -----------------

    @TableField(exist = false)
    private Dept dept; // 所属部门

    @TableField(exist = false)
    private List<Role> roles; // 用户角色

    @TableField(exist = false)
    private List<Title> titles; // 用户职称

    @TableField(exist = false)
    private List<Position> positions; // 用户岗位

    @TableField(exist = false)
    private List<Duty> duties; // 用户职务

    @TableField(exist = false)
    private List<Education> educations; // 用户学历/学位
}
